//
//  HBGetInviteCodeParser.m
//  HuoBao
//
//  Created by chaiyanan on 15/12/8.
//  Copyright © 2015年 jinxin. All rights reserved.
//

#import "HBGetInviteCodeParser.h"
#import "HBGetInviteCodeInfo.h"

@implementation HBGetInviteCodeParser

-(ParserResult*)parseResponseDictionary:(NSDictionary *)responseDictionary
{
    LLog(@"responseDictionary:%@",responseDictionary);
    ParserResult* result=[[ParserResult alloc]init];
    NSNumber* codeObject=[responseDictionary objectForKey:Key_Code];
    if (codeObject)
    {
        NSInteger code = [codeObject integerValue];
        result.code = code;
        result.message = [responseDictionary objectForKey:Key_Msg];
        if (code == 0)
        {
            NSString *dataStr = [DataTypeTranslate stringToString:[responseDictionary objectForKey:Key_Data]];
            if (dataStr&&dataStr.length>0)
            {
                HBGetInviteCodeInfo *info = [[HBGetInviteCodeInfo alloc]init];
                info.dataInfo = dataStr;
                result.result = info;
            }
            else
            {
                result.code=1;
                result.message=@"服务器数据异常";
            }
        }
    }
    else
    {
        result.code=1;
        result.message=@"服务器数据异常";
    }
    
    return result;
}

@end
